from pom.page_teacher_op.homepage import THomePage
from lib.share import css, xpath

class THomeworkCreatedPage(THomePage):

    loc_title = (xpath,"//*[@id='dynamicView']//*[@class='col-lg-12'][@id='serach_result_table']/*[1]")
    loc_select_input = (xpath,"//*[@id='dynamicView']//*[@class='col-lg-12'][@id='serach_result_table']/../../*[3]/*[2]/div/input")
    loc_select_button = (xpath,"//*[@class='input-group']/div/button")

    loc_created_question = (xpath,"//*[@class='div-search-result-one-text']")

    loc_question_method = xpath
    created_homework_name = "//*[@id='dynamicView']//*[@class='col-lg-12'][@id='serach_result_table']/*[index1]/*[1]"
    button_created_check = "//*[@id='dynamicView']//*[@class='col-lg-12'][@id='serach_result_table']/*[index1]/*[4]/*[1]/*[1]"
    button_created_change = "//*[@id='dynamicView']//*[@class='col-lg-12'][@id='serach_result_table']/*[index1]/*[4]/*[1]/*[2]"
    button_created_delete = "//*[@id='dynamicView']//*[@class='col-lg-12'][@id='serach_result_table']/*[index1]/*[4]/*[1]/*[3]"
    button_created_released = "//*[@id='dynamicView']//*[@class='col-lg-12'][@id='serach_result_table']/*[index1]/*[4]/*[1]/*[4]"

    loc_delete_pop_submit = (xpath,"//*[@class='bootstrap-dialog-footer-buttons']/*[2]")
    loc_delete_pop_cancel = (xpath,"//*[@class='bootstrap-dialog-footer-buttons']/*[1]")

    #编辑作业界面
    loc_homework_change_title = (xpath,"//*[@class='page-header pull-left']/div")

    loc_homework_change_qusetions = (xpath,"//*[@class='div-search-result-one']")

    loc_question_content_value = "//*[@id='exam_question_list_choice']/div/div/*[index1]/*[2]/p"
    loc_homework_change_button_check_value = "//*[@id='exam_question_list_choice']/div/div/*[index1]/*[3]/div/*[1]"
    loc_homework_change_button_delete_value = "//*[@id='exam_question_list_choice']/div/div/*[index1]/*[3]/div/*[2]"
    loc_homework_change_button_up_value = "//*[@id='exam_question_list_choice']/div/div/*[index1]/*[3]/div/*[3]"
    loc_homework_change_button_down_value = "//*[@id='exam_question_list_choice']/div/div/*[index1]/*[3]/div/*[4]"

    def question_change_page_get_question_info(self,index_input):
        question_content_list = []

        value = self.loc_question_content_value.replace('index1',str(index_input))
        loc = (xpath,value)
        question = self.locates(loc)
        question_content_list.append(question[0].text)
        question_content_list.append(question[-4].text)
        question_content_list.append(question[-3].text)
        question_content_list.append(question[-2].text)
        question_content_list.append(question[-1].text)

        return question_content_list




